package com.elvin.uicontrols;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.MultiAutoCompleteTextView;

public class AtyUsingAutoCompleteTextView extends Activity {
	
	private AutoCompleteTextView actv;
	private MultiAutoCompleteTextView mactv;
	private ArrayAdapter<String> actvAdapter, mactvAdapter;
	private String[] strs = new String[]{
			"hello",
			"hello Elvin",
			"hello youmu.com",
			"hello Luck2Elvin",
			"hello IOS",
			"java",
			"php",
			"python",
			"javascripte"};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.aty_using_autocompletetextview);
		
		//adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line);
		actvAdapter = new ArrayAdapter<String>(this, R.layout.aty_using_autocompletetextview_dropdown_item, strs);
//		adapter.add("Hello");
//		adapter.add("Elvin");
//		adapter.add("youmu.com");
//		adapter.add("Java");
//		adapter.add("Javascript");
		
		
		actv = (AutoCompleteTextView)findViewById(R.id.autoCompleteTextView);
		actv.setAdapter(actvAdapter);
		
		mactv = (MultiAutoCompleteTextView) findViewById(R.id.multiAutoCompleteTextView);
		
		mactvAdapter = new ArrayAdapter<String>(this, R.layout.aty_using_autocompletetextview_dropdown_item, strs);
		//设置分隔符
		mactv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
		mactv.setAdapter(mactvAdapter);
		
	}
}
